﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Steve.UI.Controllers;
using System.Web.Mvc;
using Steve.UI.Models;
using System.ComponentModel.Composition;
using Microsoft.ComponentModel.Composition.Extensions.Web;
using Steve.UI.Administration.Controllers;
using Steve.UI.Administration.Models;

namespace Steve.UI.Site.Controllers
{
    [SiteMasterData]
    [Authorize(Roles = "Steve-Content Writer, Steve-Content Reader, Steve-Sys Admin")]
    [Export(typeof(IController))]
    [ExportMetadata("Name", "ContentManagement")]
    [ExportMetadata("Mode", WebScopeMode.Request)]
    [PartCreationPolicy(CreationPolicy.NonShared)]
    public class ContentManagementController : ContentManagementControllerBase
    {
        [Authorize(Roles = "Steve-Sys Admin")]
        public override void SimilarityCacheRebuildAsync()
        {
            base.SimilarityCacheRebuildAsync();
        }

        [Authorize(Roles = "Steve-Content Writer, Steve-Sys Admin")]
        public override ActionResult ContentDetailPost(ExistingContentDetailModel model, Guid id)
        {
            return base.ContentDetailPost(model, id);
        }

        [Authorize(Roles = "Steve-Content Writer, Steve-Sys Admin")]
        public override ActionResult ContentDetailPost(NewContentDetailModel model)
        {
            return base.ContentDetailPost(model);
        }

        [RouteValueAbsent("pathInfo")]
        public override ActionResult ContentDetail(Guid? id, int similarCount = DefaultSimilarCount)
        {
            return base.ContentDetail(id, similarCount);
        }

        [Authorize(Roles = "Steve-Sys Admin")]
        public override ActionResult RebuildSearchIndex()
        {
            return base.RebuildSearchIndex();
        }
    }
}